#ifndef __TRACKER_H__
#define __TRACKER_H__
#include "httpd.h"

#define ANNOUNCE_INTERVAL 	1800		/* Announce interval	 					*/ 
#define PEER_LIMIT			200			/* Max amount of peers to send to client. 	*/

struct tracker_thread_vars
{
	char *params[20];
	char buf[256];
	char *passkey;
	char escaped_passkey[64];
	char *info_hash;
	char escaped_info_hash[40];
	char *peer_id;
	char escaped_peer_id[40];
	int event;
	long int downloaded;
	long int uploaded;
	long int left;
	int paramcount;
	int torrentid;
	int userid;	
	int portnum;
	int i;
	
	unsigned int num_rows;
	char query[512]; /* 256 bytes should be more than enough. */
};

void tracker_handle_req(struct http_thread_vars *http_vars);
void tracker_send_error(struct http_thread_vars *http_vars, char *msg);
void tracker_send_resp(struct http_thread_vars *http_vars, char *msg);
void tracker_run(struct tracker_thread_vars *tracker_vars, struct http_thread_vars *http_vars);

#endif
